﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace LogoScriptIDE
{
    /// <summary>
    /// DebuggerToolsWindow.xaml 的交互逻辑
    /// 调试工具窗口，包括控制台，堆栈查看器和变量查看器
    /// </summary>
    public partial class DebuggerToolsWindow : Window
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public DebuggerToolsWindow()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 获取堆栈窗口
        /// </summary>
        public StackWindow GetStackWindow()
        {
            return ui_StackWindow;
        }

        /// <summary>
        /// 获取控制台窗口
        /// </summary>
        public ConsoleWindow GetConsoleWindow()
        {
            return ui_ConsoleWindow;
        }

        /// <summary>
        /// 获取变量窗口
        /// </summary>
        public WatchesWindow GetWatchesWindow()
        {
            return ui_WatchesWindow;
        }

        /// <summary>
        /// 选择窗口分页
        /// </summary>
        /// <param name="tabIndex">分页序号</param>
        public void SwitchToTab(int tabIndex)
        {
            ui_MainTab.SelectedIndex = tabIndex;
        }

        /// <summary>
        /// 控制台窗口的分页序号
        /// </summary>
        public const int TabConsoleWindow = 0;
        /// <summary>
        /// 堆栈窗口的分页序号
        /// </summary>
        public const int TabStackWindow = 1;
        /// <summary>
        /// 变量窗口的分页序号
        /// </summary>
        public const int TabWatchesWindow = 2;

        /// <summary>
        /// 窗口关闭回调函数
        /// </summary>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // 隐藏而不是关闭窗口
            e.Cancel = true;
            Hide();
        }
    }
}
